<form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <td style="width: 1px;" class="text-center">
                <!--
                    <input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);">
                -->    
                </td>                
                <td class="text-left">
                    <a href="javascript:sort('order_sn');">订单标识</a>
                </td>

                <td class="text-left">
                    <a href="javascript:sort('refund_money');">退款金额</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('pay_type');">支付方式</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('status');">退款状态</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('create_time');">申请时间</a>
                </td>
                <td class="text-right">操作</td>
            </tr>
            </thead>
            <tbody>
            <volist name="refundList" id="list">
                <tr>
                    <td class="text-center">
                       <!-- <input type="checkbox" name="selected[]" value="6">-->
                        <input type="hidden" name="shipping_code[]" value="flat.flat">
                    </td>
                    <td class="text-left">{$list.order_sn}</td>
                    <td class="text-left">{$list.refund_money}</td>
                    <td class="text-left">
                        <if condition="$list.pay_type eq 1" >
                            余额支付
                            <elseif condition="$list.pay_type eq 2" />
                                微信支付
                        </if>
                    </td>

                    <td class="text-left" id="refund-{$list.refund_id}">
                        <if condition="$list.status eq 0" >
                            受理中
                            <elseif condition="$list.status eq 1" />
                            已完成
                        </if>
                    </td>
                    <td class="text-left">{:date('Y-m-d H:i:s', $list['create_time'])}</td>

                    <td class="text-right">
                        <a href="#" onclick="confimRefund({$list.refund_id})" class="btn btn-primary" title="编辑"><i class="fa fa-pencil"></i></a>
                    </td>                        
                </tr>
            </volist>
            </tbody>
        </table>
    </div>
</form>
<div class="row">
    <div class="col-sm-3 text-left"></div>
    <div class="col-sm-9 text-right">{$page}</div>
</div>
<script>
    // 点击分页触发的事件
    $(".pagination  a").click(function(){
        cur_page = $(this).data('p');
        ajax_get_table('search-form2',cur_page);
    });
    /*
     * 清除静态页面缓存
     */
    function ClearGoodsHtml(goods_id)
    {
    	$.ajax({
				type:'GET',
				url:"{:U('Admin/System/ClearGoodsHtml')}",
				data:{goods_id:goods_id},
				dataType:'json',
				success:function(data){
					layer.alert(data.msg, {icon: 2});								 
				}
		});
    }
    /*
     * 清除商品缩列图缓存
     */
    function ClearGoodsThumb(goods_id)
    {
    	$.ajax({
				type:'GET',
				url:"{:U('Admin/System/ClearGoodsThumb')}",
				data:{goods_id:goods_id},
				dataType:'json',
				success:function(data){
					layer.alert(data.msg, {icon: 2});								 
				}
		});
    }

    //管理员确认退款请求
    function confimRefund(refund_id) {
        layer.msg('是否通过审核?'
                  ,{
                    time:0
                    ,btn:['确认','取消']
                    ,yes:function (index) {
                        layer.close(index);
                        $.ajax({
                            type:"post",
                            url:"__URL__/confirmRefund",
                            data:{
                                refund_id: refund_id
                            },
                            error:function (data) {
                                console.info(data);
                                layer.msg('服务器异常');
                            }
                            ,success:function (data) {
                                console.info(data);
                                layer.close(index);
                                layer.msg(data.msg);
                                if(data.status > 0){
                                    $('#refund-' + refund_id).empty().html('已完成');
                                }
                            }
                        });
                    }
                }
        );

    }
</script>